package com.taptech.doufu.ui.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.taptech.doufu.R
import kotlinx.android.synthetic.main.adapter_punctuation.view.*

class PunctuationAdapter(context: Context, private val onClickItem: OnClickItem):BaseRecyclerAdappter<String,PunctuationAdapter.ViewHolder>(context) {


    interface OnClickItem{
        fun onClick(position: Int,title:String)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(mContext).inflate(R.layout.adapter_punctuation,parent,false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        val item = dataList[position]
        holder.itemView.tvTitle.text = item
        holder.itemView.setOnClickListener {
            onClickItem.onClick(position,item)
        }
    }

    class ViewHolder(view: View): RecyclerView.ViewHolder(view)
}